home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / SW Demo / Demo Source / Utility.c < prev    next >
Encoding:
Text File  |  1994-10-07  |  1.7 KB  |  56 lines  |  [TEXT/MPCC]

  1. // ----------------------------------------------------------------------------------
  2. // Utility.c
  3. // ----------------------------------------------------------------------------------
  4. // Various utility functions.
  5. //
  6. // This demo is copywrite 1994 by LexTek Internation.  Feel free to use it for
  7. // whatever purpose you wish.  The SpellWright Library may not be copied or 
  8. // distributed, except when linked to your application that adds significant features
  9. // to the code.  ie. you can't take the library, make a new library and sell it.  You
  10. // can, however, use it without royalties in applications or other such projects.
  11. //
  12. // LexTek International
  13. // 2255 N. University Parkway, Suit 15
  14. // Provo, UT 84604
  15. // (801) 375.8332  Phone
  16. // (801) 375.7654  Fax 
  17. //
  18. // ----------------------------------------------------------------------------------
  19. // History:
  20. //    9/26/94        Clark Goble    Original
  21. //
  22.  
  23. // ----------------------------------------------------------------------------------
  24. // pstrcat
  25. // ----------------------------------------------------------------------------------
  26. // Concatinates two pascal strings.
  27.  
  28. void pstrcat(register char *s1, register char *s2)
  29. {
  30.     register char *p;
  31.     register short len, i;
  32.     
  33.     if (*s1+*s2<=255) 
  34.     {
  35.         p = *s1 + s1 + 1;
  36.         *s1 += (len = *s2++);
  37.     }
  38.     else 
  39.     {
  40.         *s1 = 255;
  41.         p = s1 + 256 - (len = *s2++);
  42.     }
  43.     for (i=len; i; --i) *p++ = *s2++;
  44. }
  45.  
  46. // ----------------------------------------------------------------------------------
  47. // TrapAvailable
  48. // ----------------------------------------------------------------------------------
  49. // Returns whether a specific trap is available.
  50.  
  51. Boolean TrapAvailable ( short tNum, short tType)
  52. {
  53.     return ( NGetTrapAddress(tNum,tType) != GetToolTrapAddress(_Unimplemented) );
  54. }
  55.  
  56.